package com.lz.gamll.feign.search;

import com.lz.gamll.feign.search.fallBack.GoodsFeignClientFallBack;
import com.lz.gmall.common.result.Result;
import com.lz.gmall.search.dto.SearchParamDTO;
import com.lz.gmall.search.entity.Goods;
import com.lz.gmall.search.vo.SearchResponseVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(value = "service-search",fallback = GoodsFeignClientFallBack.class)
public interface GoodsFeignClient {

    //用于上架商品，把商品信息存入ES数据库中
    @PostMapping("/api/inner/search/saveGoods")
    public Result saveGoods(@RequestBody Goods goods);

    //用于下架商品，把商品数据从es数据库中删除
    @PostMapping("/api/inner/search/deleteGoods/{skuId}")
    public Result deleteGoodsById(@PathVariable("skuId")Long skuId);

    //用于检索商品
    @PostMapping("/api/inner/search/searchGoods")
    public Result<SearchResponseVo> search(@RequestBody SearchParamDTO searchParamDTO);

    //用于修改es数据库中的热点参数
    @GetMapping("/api/inner/search/updateHotScore/{goodsId}/{hotScore}")
    public Result updateHotScore(@PathVariable("hotScore")Long hotScore,@PathVariable("goodsId")Long goodsId);
}
